<template>
  <div class="app">
    <h2>
      父组件---钱包: {{ money }}--车: {{ car }} -- 房: {{ house }}
    </h2>
    <HmSon :money="money" :car="car" :house="house" @addMoney="addMoneyFn" @changeCar="changeCarFn" />
  </div>
</template>

<script>
import HmSon from './components/HmSon.vue';
export default {
  name: 'App',
  data() {
    return {
      money: 1000,
      car: '自行车',
      house: '茅草房'
    }
  },
  // 2. 注册组件
  components: {
    HmSon
  },
  methods: {
    addMoneyFn(money) {
      this.money += money;
    },
    changeCarFn(car) {
      this.car = car;
      this.money -= 1500000
    }
  }
}
</script>

<style lang="less">
.app {
  width: 800px;
  height: 400px;
  background-color: skyblue;
}
</style>
